set the lockText of card field "voiceListField" to false
set the scroll of card field "voiceListField" to 0
set rect of card field "voiceListField" to 297,29,504,337
set the lockText of card field "defaultVoiceListField" to true
set the rect of card field "defaultVoiceListField" to 297,29,504,337
set the visible of card field "defaultVoiceListField" to false
set the scroll of card field "menuHelpField" to 0
set the lockText of card field "menuHelpField" to true
set the rect of card field "menuHelpField" to 6,77,290,337
end openCard
on closeCard
global rebuildPopUpMenu,voice
put true into rebuildPopUpMenu
testForEmptyVoiceList
deleteEmptyLines "VoiceListField"
put false into validVoice
repeat with i = 1 to number of lines in card field "voiceListField"
if line i of card field "voiceListField" = voice then
put true into validVoice
exit repeat
end if
end repeat
if validVoice = false then
put line 1 of card field "voiceListField" into voice
if voice = "Silence" then
put line 2 of card field "voiceListField" into voice
end if
end if
put voice into line 4 of card field "storedValues" of card "piano keyboard"
end closeCard
on testForEmptyVoiceList
if card field "voiceListField" is empty then
set the cursor to 4
beep
answer "Hey! The ‘snd ’ resource names list is empty." with "Put it back"
send mouseUp to card button "Restore Default List"
end if
end testForEmptyVoiceList
on deleteEmptyLines theField
put false into refresh
put empty into temp
put the number of lines of card field theField into lineCount
repeat with i = 1 to lineCount
get line i of card field theField
put it into theVoiceName
if the number of chars of theVoiceName <= 1 then
put true into refresh
next repeat
end if
put theVoiceName&return after temp
end repeat
if refresh is true then
put temp into card field theField
end if
end deleteEmptyLines
on doMenu which
if which is "Cut Text" or which is "Clear Text" then
send "doMenu Cut Text" to HyperCard
exit doMenu
end if
if which is "Paste Text" then
send "doMenu Paste Text" to HyperCard
exit doMenu
end if
pass "doMenu"
end doMenu
-- part 15 (field)
-- low flags: 81
-- high flags: 2007
-- rect: left=297 top=29 right=337 bottom=504
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: defaultVoiceListField
-- part 22 (button)
-- low flags: 00
-- high flags: A000
-- rect: left=55 top=23 right=72 bottom=98
-- title width / last selected line: 0
-- icon id / first selected line: 20882 / 20882
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Help
----- HyperTalk script -----
on mouseUp
visual effect iris open
go to card "helpCard"
end mouseUp
-- part 23 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=347 top=90 right=114 bottom=385
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: theScrollAmtField
----- HyperTalk script -----
voiceListAmtField
-- part 9 (field)
-- low flags: 01
-- high flags: 2007
-- rect: left=6 top=77 right=337 bottom=290
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: menuHelpField
-- part 10 (button)
-- low flags: 00
-- high flags: A000
-- rect: left=6 top=24 right=71 bottom=54
-- title width / last selected line: 0
-- icon id / first selected line: 30238 / 30238
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Keyboard
----- HyperTalk script -----
on mouseUp
visual effect dissolve
go to card "piano keyboard"
end mouseUp
-- part 16 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=134 top=29 right=62 bottom=291
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Restore Default List
----- HyperTalk script -----
-- voiceListField: the list of available ‘snd ’ resources
-- defaultVoiceListField:the default list of available ‘snd ’ resources
on mouseUp
global theSelection
put empty into theSelection
put "voiceListField" into toField
put "defaultVoiceListField" into fromField
put the number of lines of card field fromField into lineCount
put empty into card field toField
repeat with i = 1 to lineCount
put line i of card field fromField&return after card field toField
play line i of card field toField
end repeat
set the scroll of card field toField to 0
end mouseUp
-- part 1 (field)
-- low flags: 00
-- high flags: 2007
-- rect: left=297 top=29 right=337 bottom=504
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: voiceListField
-- part 20 (field)
-- low flags: 81
-- high flags: 2004
-- rect: left=5 top=24 right=128 bottom=340
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: deleteSNDHelpField
----- HyperTalk script -----
on mouseUp
set the visible of me to false
set the visible of card button "OK" to false
end mouseUp
-- part 21 (button)
-- low flags: 80
-- high flags: A003
-- rect: left=123 top=87 right=115 bottom=196
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: OK
----- HyperTalk script -----
on mouseUp
set the visible of card field "deleteSNDHelpField" to false
set the visible of me to false
end mouseUp
-- part contents for card part 9
----- text -----
—Customizing the pop-up Voice menu—
Add the names of any installed 'snd ' resources that you wish to use. When you return to the main card, the new voices will appear in the menu inside the Voice button. Misspelled names will be treated by HyperCard as the Silence voice. Attempting to delete the entire list will restore the default set.
This version of Sound Scripter is stripped down with no 'snd 'resources of its own for to save space. My working copy, with 31 voices weighs in at 516K.
Only 32 items will fit in the pop-up menu, and I have reserved the first item to send you to this card, so any voice installed after the 31st one in the list at the right will not appear in the menu. Rearrange the names so that the voices you will be needing on the current script will be within the first 31 listed.
The Silence voice is not required as rests can be included in the script without it ( by holding down the Option key while clicking on a note button on the keyboard ). See the Help cards for more information.
Names in the "voiceListField" at the right are not always what they appear to be. A name so long that it wraps around to the next line will appear in the actual pop-up Voice menu as one line (assuming that it is no wider than the screen), and double-clicking on it in the "voiceListField" should select the entire name. If you experience trouble with very long names, try stretching the "voiceListField" to the full width of the screen.
Don’t worry about empty lines in the list, they’ll be removed before the actual Voice menu is reconstructed.
If you want your customized Voice list to become the default Voice list, you can find the default list field
(named "defaultVoiceListField") under the editable list at the right. To work on it, move the "voiceListField" aside and type { set the visible of card field "defaultVoiceListField" to true } without the brackets into the message box and hit the return key. Turn off the "Lock Text" button and rearrange to your heart’s content, at your own risk, of course. The next time this card receives the "openCard" message the fields will return to their correct location with the default list’s text properly locked.
My script checks to see that you haven’t deleted the entire list when you go to another card, so regardless of the editing method you use, you should at least find something in the pop-up Voice menu when you next use it.
I use ResEdit to install 'snd ' resources, but ResEdit can wreck havoc in inexperienced hands, so only attempt this if you know what you’re doing or don’t much care if you trash your software in the process. There are a number of stacks and utilities available to move 'snd ' resources painlessly. I had hoped to automate the installing of resources with a Font/DA style of interface, but I need an 'XCMD' to poll the resources first.
-- part contents for card part 15
----- text -----
Silence
Boing
Harpsichord
-- part contents for card part 20
----- text -----
Click on a voice from the “Available Voices” scrolling field to select it, then click on the “delete Voice” button to remove it.